<Project>
  <PropertyGroup>
    <TestProjectName Condition="'$(TestProjectName)' == ''">$(MSBuildProjectName)</TestProjectName>
    <TestFramework Condition="'$(TestFramework)' == ''">xunit</TestFramework>
    <!-- Implicit test build support when invoking the Test target on the project directly. -->
    <TestDependsOn Condition="'$(TestNoBuild)' != 'true' and '$(BuildAllProjects)' != 'true'">Build</TestDependsOn>
    <TestDependsOn>$(TestDependsOn);GenerateRunScript;RunTests</TestDependsOn>
    <VSTestNoLogo>true</VSTestNoLogo>
    <ILLinkDescriptorsPath>$(MSBuildThisFileDirectory)ILLinkDescriptors\</ILLinkDescriptorsPath>
    <TestSingleFile Condition="'$(TestNativeAot)' == 'true'">true</TestSingleFile>
    <TestSingleFile Condition="'$(TestReadyToRun)' == 'true'">true</TestSingleFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetsMobile)' == 'true'">
    <!-- Test runners are built as part of libs.pretest so we need to use libraries configuration -->
    <AppleTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleTestRunner', '$(Configuration)', '$(NetCoreAppCurrent)'))</AppleTestRunnerDir>
    <AndroidTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidTestRunner', '$(Configuration)', '$(NetCoreAppCurrent)'))</AndroidTestRunnerDir>
    <WasmTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmTestRunner', '$(Configuration)', '$(NetCoreAppCurrent)'))</WasmTestRunnerDir>

    <RuntimeIdentifier>$(OutputRID)</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
  </PropertyGroup>

  <!-- Provide runtime options to Mono (interpreter, aot, debugging, etc) -->
  <ItemGroup Condition="'$(MonoEnvOptions)' != '' and '$(TargetsMobile)' != 'true'">
    <RunScriptCommands Condition="'$(TargetsWindows)' == 'true' or '$(TargetPlatformIdentifier)' == 'windows'" Include="set MONO_ENV_OPTIONS='$(MonoEnvOptions)'" />
    <RunScriptCommands Condition="'$(TargetsWindows)' != 'true' and '$(TargetPlatformIdentifier)' != 'windows'" Include="export MONO_ENV_OPTIONS='$(MonoEnvOptions)'" />
  </ItemGroup>

  <ItemGroup Condition="'$(TestRunRequiresLiveRefPack)' == 'true'">
    <None Include="$(MicrosoftNetCoreAppRefPackRefDir)**/*.dll" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" LinkBase="live-ref-pack/" Visible="false" />
  </ItemGroup>

  <!--
    Unit/Functional/Integration test support.
    Supported runners: xunit.
  -->
  <Import Project="$(MSBuildThisFileDirectory)xunit\xunit.props" Condition="'$(TestFramework)' == 'xunit'" />
</Project>
